import random

def generate_lucky_numbers():
    return random.sample(range(1, 34), 8)

def compare_numbers(lucky_numbers, specific_numbers):
    correct_count = sum(1 for num in specific_numbers if num in lucky_numbers)
    wrong_count = 8 - correct_count
    return wrong_count

def determine_prize(wrong_count):
    if wrong_count == 0:
        return "一等奖"
    elif wrong_count == 1:
        return "二等奖"
    elif wrong_count == 2:
        return "三等奖"
    elif wrong_count == 3:
        return "四等奖"
    else:
        return "未中奖"

def simulate_lottery(specific_numbers, num_tickets=10000):
    prizes = {"一等奖": 0, "二等奖": 0, "三等奖": 0, "四等奖": 0, "未中奖": 0}

    for _ in range(num_tickets):
        lucky_numbers = generate_lucky_numbers()
        wrong_count = compare_numbers(lucky_numbers, specific_numbers)
        prize = determine_prize(wrong_count)
        prizes[prize] += 1

    return prizes

def main():
    specific_numbers = [1, 2, 3, 4, 5, 6, 7, 8]  # 你可以更改这个特定号码
    num_tickets = 10000

    prizes = simulate_lottery(specific_numbers, num_tickets)

    print(f"模拟购买 {num_tickets} 注彩票的结果:")
    for prize, count in prizes.items():
        probability = (count / num_tickets) * 100
        print(f"{prize}: {count} 次, 概率为 {probability:.2f}%")

if __name__ == "__main__":
    main()
